package com.yuan.department.utils;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidDataSourceFactory;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @program: Train
 * @description:
 * @author: yuan_boss
 * @create: 2022-11-23 15:38
 **/
public class DruidPoolUtil {
    public static DruidDataSource dataSource;
    private static Properties p  = new Properties();

    static {
        InputStream is = DruidPoolUtil.class.getClassLoader().getResourceAsStream("jdbc.properties");

        try {
            p.load(is);
            dataSource = (DruidDataSource)DruidDataSourceFactory.createDataSource(p);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
